package com.huc.netty.example.consumer.proxy;

import java.lang.reflect.Proxy;

/**
 * @author huc
 * @version 1.0
 * @note
 * @date 2021/9/16 11:18
 */
public class RpcClientProxy {

    public <T> T clientProxy(final Class<T> interfaceCls, final String host, int port) {
        return (T) Proxy.newProxyInstance(interfaceCls.getClassLoader(),
                new Class<?>[]{interfaceCls}, new RpcClientInvocationHandler(host, port));
    }

}
